package cn.stronglink.netrequest.business.user;
import com.google.gson.Gson;

import java.util.HashMap;
import java.util.Map;

import cn.stronglink.netrequest.exceptions.BusinessErrorException;
import cn.stronglink.netrequest.util.HttpURL;
import cn.stronglink.netrequest.util.HttpUtil;
import okhttp3.Callback;

/**
 * Created by Tgb on 2018/6/4.
 * 登陆
 */

public class LoginService{

    private Gson gson = new Gson();
    // 登录
    public void login(String userName,String password,Callback callback) throws Exception {
        Map<String,String> map = new HashMap<>();
        map.put("account",userName);
        map.put("password",password);
        map.put("type","2");
        String json = gson.toJson(map);
        HttpUtil.httpPost(HttpURL.URL_LOGIN, json, callback);
    }
    // 登出
    public void loginOut(Callback callback) throws Exception {
        HttpUtil.httpPost(HttpURL.URL_LOGIN_OUT,callback);
    }
}
